/**
* Created by wust on 2019/5/24.
*/
<template>
  <div>
    <el-button-group style="margin-bottom: 5px;">
      <el-button size="mini" type="primary" v-file-download-directive="'user_template.xls'">下载模版</el-button>
    </el-button-group>
    <el-form  label-width="120px" @submit.native.prevent>
      <file-upload-component :src="uploadUrl" :fileType="'xls,xlsx'" :fileSize="10" :fileNumber="1" v-on:importCallback="importCallback"></file-upload-component>
    </el-form>
  </div>
</template>
<script>
import Vue from 'vue'
import FileUploadComponent from '../../../common/component/file-upload-component.vue'
export default {
  name: 'user-import',
  components: {
    FileUploadComponent
  },
  data () {
    return {
      uploadUrl: Vue.$adminServerURL + '/web/v1/UserController/importByExcel?moduleName=user'
    }
  },
  methods: {
    importCallback: function (e) { // 回调
      this.$confirm('导入完成，需要跳转到结果页面吗？', '询问', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$router.push({path: '/MyImportExportList'})
      }).catch(() => {
      })
    }
  }
}
</script>
